home *** CD-ROM | disk | FTP | other *** search
/ Programming Microsoft Visual Basic .NET / Programming Microsoft Visual Basic .NET (Microsoft Press)(X08-78517)(2002).bin / setup / vbnet / 26 web services / moneyconverterclient / form1.vb < prev    next >
Encoding:
Text File  |  2002-03-19  |  5.4 KB  |  145 lines

  1. Public Class Form1
  2.     Inherits System.Windows.Forms.Form
  3.  
  4. #Region " Windows Form Designer generated code "
  5.  
  6.     Public Sub New()
  7.         MyBase.New()
  8.  
  9.         'This call is required by the Windows Form Designer.
  10.         InitializeComponent()
  11.  
  12.         'Add any initialization after the InitializeComponent() call
  13.  
  14.     End Sub
  15.  
  16.     'Form overrides dispose to clean up the component list.
  17.     Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
  18.         If disposing Then
  19.             If Not (components Is Nothing) Then
  20.                 components.Dispose()
  21.             End If
  22.         End If
  23.         MyBase.Dispose(disposing)
  24.     End Sub
  25.  
  26.     'Required by the Windows Form Designer
  27.     Private components As System.ComponentModel.IContainer
  28.  
  29.     'NOTE: The following procedure is required by the Windows Form Designer
  30.     'It can be modified using the Windows Form Designer.  
  31.     'Do not modify it using the code editor.
  32.     Friend WithEvents Label1 As System.Windows.Forms.Label
  33.     Friend WithEvents Label2 As System.Windows.Forms.Label
  34.     Friend WithEvents btnToDollars As System.Windows.Forms.Button
  35.     Friend WithEvents txtDollars As System.Windows.Forms.TextBox
  36.     Friend WithEvents txtEuros As System.Windows.Forms.TextBox
  37.     Friend WithEvents btnToEuros As System.Windows.Forms.Button
  38.     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  39.         Me.txtDollars = New System.Windows.Forms.TextBox()
  40.         Me.Label1 = New System.Windows.Forms.Label()
  41.         Me.txtEuros = New System.Windows.Forms.TextBox()
  42.         Me.Label2 = New System.Windows.Forms.Label()
  43.         Me.btnToDollars = New System.Windows.Forms.Button()
  44.         Me.btnToEuros = New System.Windows.Forms.Button()
  45.         Me.SuspendLayout()
  46.         '
  47.         'txtDollars
  48.         '
  49.         Me.txtDollars.Location = New System.Drawing.Point(24, 32)
  50.         Me.txtDollars.Name = "txtDollars"
  51.         Me.txtDollars.Size = New System.Drawing.Size(136, 24)
  52.         Me.txtDollars.TabIndex = 1
  53.         Me.txtDollars.Text = ""
  54.         '
  55.         'Label1
  56.         '
  57.         Me.Label1.Location = New System.Drawing.Point(24, 8)
  58.         Me.Label1.Name = "Label1"
  59.         Me.Label1.TabIndex = 2
  60.         Me.Label1.Text = "Dollars"
  61.         '
  62.         'txtEuros
  63.         '
  64.         Me.txtEuros.Location = New System.Drawing.Point(264, 32)
  65.         Me.txtEuros.Name = "txtEuros"
  66.         Me.txtEuros.Size = New System.Drawing.Size(136, 24)
  67.         Me.txtEuros.TabIndex = 3
  68.         Me.txtEuros.Text = ""
  69.         '
  70.         'Label2
  71.         '
  72.         Me.Label2.Location = New System.Drawing.Point(264, 8)
  73.         Me.Label2.Name = "Label2"
  74.         Me.Label2.TabIndex = 4
  75.         Me.Label2.Text = "Euros"
  76.         '
  77.         'btnToDollars
  78.         '
  79.         Me.btnToDollars.Location = New System.Drawing.Point(168, 32)
  80.         Me.btnToDollars.Name = "btnToDollars"
  81.         Me.btnToDollars.Size = New System.Drawing.Size(40, 23)
  82.         Me.btnToDollars.TabIndex = 5
  83.         Me.btnToDollars.Text = "<"
  84.         '
  85.         'btnToEuros
  86.         '
  87.         Me.btnToEuros.Location = New System.Drawing.Point(216, 32)
  88.         Me.btnToEuros.Name = "btnToEuros"
  89.         Me.btnToEuros.Size = New System.Drawing.Size(40, 23)
  90.         Me.btnToEuros.TabIndex = 6
  91.         Me.btnToEuros.Text = ">"
  92.         '
  93.         'Form1
  94.         '
  95.         Me.AutoScaleBaseSize = New System.Drawing.Size(7, 17)
  96.         Me.ClientSize = New System.Drawing.Size(424, 77)
  97.         Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnToEuros, Me.btnToDollars, Me.txtEuros, Me.Label2, Me.txtDollars, Me.Label1})
  98.         Me.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
  99.         Me.Name = "Form1"
  100.         Me.Text = "Form1"
  101.         Me.ResumeLayout(False)
  102.  
  103.     End Sub
  104.  
  105. #End Region
  106.  
  107.     ' this converts from dollars to euros
  108.  
  109.     Private Sub btnToEuros_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnToEuros.Click
  110.         ' create an instance of the proxy class
  111.         Dim conv As New localhost.Converter()
  112.         ' get the operand
  113.         Dim value As Decimal = CDec(txtDollars.Text)
  114.         ' call the remote method
  115.         Dim result As Decimal = conv.DollarToEuro(value)
  116.         ' show the result
  117.         txtEuros.Text = result.ToString
  118.     End Sub
  119.  
  120.     ' this converts from euros to dollars
  121.  
  122.     Private Sub btnToDollars_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnToDollars.Click
  123.         ' create an instance of the proxy class
  124.         Dim conv As New localhost.Converter()
  125.         ' get the operand
  126.         Dim value As Decimal = CDec(txtEuros.Text)
  127.         ' call the remote method
  128.         Dim result As Decimal = conv.EuroToDollar(value)
  129.         ' show the result
  130.         txtDollars.Text = result.ToString
  131.     End Sub
  132.  
  133.     ' clear the dollar field when a key is pressed in the euro field
  134.  
  135.     Private Sub txtEuros_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtEuros.KeyPress
  136.         txtDollars.Clear()
  137.     End Sub
  138.  
  139.     ' clear the euro field when a key is pressed in the dollar field
  140.  
  141.     Private Sub txtDollars_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtDollars.KeyPress
  142.         txtEuros.Clear()
  143.     End Sub
  144. End Class
  145.